package com.zhuo.boot.controller;

import com.zhuo.boot.bean.Car;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller
//@ResponseBody
@RestController     //@RestController 是 @Controller 和 @ResponseBody 的合体，表示这个类所有方法不进行转发，直接写入浏览器
@Slf4j
public class HelloController {

    @Autowired
    Car car;

    @RequestMapping("/car")
    public Car car(){
        return car;
    }


    @RequestMapping("hello2")
    public String handle01(@RequestParam("name") String name){
        log.info("请求");
        return "Hello SpringBoot2"+"你好"+name;
    }
}
